import UIKit
import AssetsLibrary

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor ( red: 1.0, green: 0.5, blue: 0.0, alpha: 1.0 )
    }
    
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        let imagePickerVC = ImagePickerViewController()
        imagePickerVC.pickerDelegate = self
        imagePickerVC.borderColor = UIColor.redColor()
        imagePickerVC.fillLabelColor = UIColor ( red: 0.0, green: 0.0, blue: 1.0, alpha: 1.0 )
        imagePickerVC.maxSelectedCount = 10
        imagePickerVC.pickerControllerTitle = "选择照片"
        imagePickerVC.leftButtonTitle = "选择照片2"
        imagePickerVC.rightButtonTitle = "选择照片3"
        imagePickerVC.authorizationAlertView = UIAlertView(title: "fasdf", message: "fadsfasdf", delegate: nil, cancelButtonTitle: "ok")
        imagePickerVC.maxSelectedAlertView = UIAlertView(title: "ffasdfasasdf", message: "fadsfasdfasdffasdf", delegate: nil, cancelButtonTitle: "ok")
        imagePickerVC.type = .Check
        presentViewController(imagePickerVC, animated: true, completion: nil)
    }
}

// MARK: <UICollectionViewDataSource> Methods
extension ViewController: ImageContentViewControllerDelegate {
    func imageContentViewController(imageContentViewController: ImageContentViewController, photosAdded: [AlbumImage], selectedImagesData: [NSData], selectedImageSize: Int64) {
        print("photosAdded: \(photosAdded)")
        print("selectedImagesData: \(selectedImagesData.count)")
        print("selectedImageSize: \(selectedImageSize)")
        
        imageContentViewController.dismissViewControllerAnimated(true, completion: nil)
    }
}
